package agent;

import common.Piece;
import common.DominoState;
import java.util.ArrayList;
import java.util.LinkedList;

public class AgentState extends DominoState {

    /**
     * List of the agent's pieces.
     */
    protected LinkedList<Piece> agentPieces;
    //peçasPossiveisDoAdversario
    protected ArrayList<Piece> opponentPossiblePieces;

    public AgentState() {
        opponentPossiblePieces = new ArrayList<>();
        agentPieces = new LinkedList<>();
    }

    public AgentState(LinkedList<Piece> agentPieces) {
        this.agentPieces = agentPieces;
        opponentPossiblePieces = new ArrayList<>();
        for (Piece piece : allPieces) {
            if (!agentPieces.contains(piece)) {
                opponentPossiblePieces.add(piece);
            }
        }
    }
     public int getAllDotsAgent(){
        int soma = 0;
        for(Piece p: agentPieces){
            soma += p.getValue1()+p.getValue2();
        }
        return soma;
    }
     
        public int getAllDotsOpponent(){
        int soma = 0;
        for(Piece p: opponentPossiblePieces){
            soma += p.getValue1()+p.getValue2();
        }
        return soma;
    }
}
